package zyn_hy_login;

public class Z8_fl
{
	private java.time.LocalDateTime add_time = java.time.LocalDateTime.MIN;
	private String add_user;
	private DataSet dsP;
	private int id;
	private int id2;
	private int id3;
	private String img;
	private String info;
	private String name;
	private String num;
	private String sign;
	private String strP;
	private int type_id;
	private String url;
	private String zt;

	public Z8_fl()
	{
	}

	public Z8_fl(String strId)
	{
		DataRow row = DBCommon.getDataBySqluniquetempvar.Tables[0].Rows[0];
		this.id = (Integer) row.getItem("id");
		this.id2 = (Integer) row.getItem("id2");
		this.id3 = (Integer) row.getItem("id3");
		this.name = row.getItem("name").toString().trim();
		this.num = row.getItem("num").toString().trim();
		this.info = row.getItem("info").toString().trim();
		this.zt = row.getItem("zt").toString().trim();
		this.img = row.getItem("img").toString().trim();
		this.url = row.getItem("url").toString().trim();
		this.sign = row.getItem("sign").toString().trim();
		this.add_time = (java.time.LocalDateTime) row.getItem("add_time");
		this.add_user = row.getItem("add_user").toString().trim();
		this.type_id = (Integer) row.getItem("type_id");
	}

	public final int DelData(String strid)
	{
		String strSql = "delete z8_fl where id = ";
		strSql = strSql + " '" + strid + "'";
		try
		{
			DBCommon.excuteSql(strSql);
		}
		catch (java.lang.Exception e)
		{
			return 0;
		}
		return 1;
	}

	public final String getMaxId(String strsign)
	{
		String strSql;
		String s;
		if (strsign.equals("sys"))
		{
			strSql = " select max(id) as mid from z8_fl where id<10000 ";
		}
		else
		{
			strSql = " select max(id) as mid from z8_fl ";
		}
		DataRow row = DBCommon.getDataBySql(strSql).Tables[0].Rows[0];
		if (row.getItem("mid") != null)
		{
			s = row.getItem("mid").toString().trim();
		}
		else
		{
			s = "0";
		}
		if ((!strsign.equals("sys")) && (Integer.parseInt(s) < 0x2710))
		{
			s = "10000";
		}
		int num = Integer.parseInt(s) + 1;
		return String.valueOf(num);
	}

	public final String getName(String strId)
	{
		DataRow row = DBCommon.getDataBySqluniquetempvar.Tables[0].Rows[0];
		return row.getItem("name").toString().trim();
	}

	public final int getNameCount(String pid, String cname, String zt)
	{
		return DBCommon.excuteSqlCount(" select * from z8_fl where name='" + cname + "'and zt='" + zt + "' and id2=" + pid);
	}

	private void getParentes(String strId)
	{
		if (!strId.equals("0"))
		{
			DataRow row = this.dsP.Tables[0].Select("id=" + strId)[0];
			this.strP = row.getItem("name").toString().trim() + "/" + this.strP;
			String text = row.getItem("id2").toString().trim();
			this.getParentes(text);
		}
	}

	public final String getParentId(String strId)
	{
		DataRow row = DBCommon.getDataBySqluniquetempvar.Tables[0].Rows[0];
		return row.getItem("id2").toString().trim();
	}

	public final String getParentString(String strId)
	{
		String strSql = " select * from z8_fl ";
		this.dsP = DBCommon.getDataBySql(strSql);
		this.getParentes(strId);
		this.strP = "总根/" + this.strP;
		return this.strP;
	}

	public final int InsertData()
	{
		Object obj2 = ((((((((((("insert into z8_fl(id,id2,id3,name,num,info,zt,img,url,sign,add_time,add_user,type_id) values( " + " " + String.valueOf(this.id) + ",") + " " + String.valueOf(this.id2) + ",") + " " + String.valueOf(this.id3) + ",") + " '" + this.name + "',") + " '" + this.num + "',") + " '" + this.info + "',") + " '" + this.zt + "',") + " '" + this.img + "',") + " '" + this.url + "',") + " '" + this.sign + "',") + " '" + this.add_time.toString("yyyy/MM/dd hh:mm:ss") + "',") + " '" + this.add_user + "',";
		String strSql = String.Concat(new Object[] {obj2, " '", this.type_id, "' )"});
		try
		{
			DBCommon.excuteSql(strSql);
		}
		catch (java.lang.Exception e)
		{
			return 0;
		}
		return 1;
	}

	public final int UpdateData()
	{
		Object obj2 = ((((((((((" update z8_fl set " + "id2 = " + String.valueOf(this.id2) + ",") + "id3 = " + String.valueOf(this.id3) + ",") + "name = '" + this.name + "',") + "num = '" + this.num + "',") + "info = '" + this.info + "',") + "zt = '" + this.zt + "',") + "img = '" + this.img + "',") + "url = '" + this.url + "',") + "sign = '" + this.sign + "',") + "add_time = '" + this.add_time.toString("yyyy/MM/dd hh:mm:ss") + "',") + "add_user= '" + this.add_user + "', ";
		Object obj3 = String.Concat(new Object[] {obj2, "type_id= ", this.type_id, " "});
		String strSql = String.Concat(new Object[] {obj3, "where id = ", this.id, ""});
		try
		{
			DBCommon.excuteSql(strSql);
		}
		catch (java.lang.Exception e)
		{
			return 0;
		}
		return 1;
	}

	public final java.time.LocalDateTime getAdd_time()
	{
		return this.add_time;
	}
	public final void setAdd_time(java.time.LocalDateTime value)
	{
		this.add_time = value;
	}

	public final String getAdd_user()
	{
		return this.add_user;
	}
	public final void setAdd_user(String value)
	{
		this.add_user = value;
	}

	public final int getId()
	{
		return this.id;
	}
	public final void setId(int value)
	{
		this.id = value;
	}

	public final int getId2()
	{
		return this.id2;
	}
	public final void setId2(int value)
	{
		this.id2 = value;
	}

	public final int getId3()
	{
		return this.id3;
	}
	public final void setId3(int value)
	{
		this.id3 = value;
	}

	public final String getImg()
	{
		return this.img;
	}
	public final void setImg(String value)
	{
		this.img = value;
	}

	public final String getInfo()
	{
		return this.info;
	}
	public final void setInfo(String value)
	{
		this.info = value;
	}

	public final String getName()
	{
		return this.name;
	}
	public final void setName(String value)
	{
		this.name = value;
	}

	public final String getNum()
	{
		return this.num;
	}
	public final void setNum(String value)
	{
		this.num = value;
	}

	public final String getSign()
	{
		return this.sign;
	}
	public final void setSign(String value)
	{
		this.sign = value;
	}

	public final int getType_id()
	{
		return this.type_id;
	}
	public final void setType_id(int value)
	{
		this.type_id = value;
	}

	public final String getUrl()
	{
		return this.url;
	}
	public final void setUrl(String value)
	{
		this.url = value;
	}

	public final String getZt()
	{
		return this.zt;
	}
	public final void setZt(String value)
	{
		this.zt = value;
	}
}